package com.itheima.demo.demo07;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class CS1 {
    public static void main(String[] args) {
        ArrayList<Person>list=new ArrayList<>();
        list.add(new Person("柳岩",28));
        list.add(new Person("白岩",18));
        list.add(new Person("黑岩",8));
        Collections.sort(list,( o1,o2)->{
            return o1.getAge()-o2.getAge()   ;
        }  );

        for (Person person : list) {
            System.out.println(person);

        }
    }
}
